Repository navigation
fix(lint)!: a knowledge source is checked for its object, its fields and the search gates that need no caller, also at publish - #37971
objectstack-fleet[bot] wants to merge 11 commits into
Conversation
…rincipal-free gates (WIP) Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…s fit one line Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
… source checks Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
📓 Docs Drift CheckThis PR changes 2 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d4c6fcda00e5521fb61505af59d9858757983a16 && git checkout d4c6fcda00e5521fb61505af59d9858757983a16
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd 830150985dc08854ae7c5e59e7e2878b9a181a67 && git checkout -B drift-repro bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd && git merge --no-ff 830150985dc08854ae7c5e59e7e2878b9a181a67
node scripts/docs-audit/affected-docs.mjs --json bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd
|
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · head f2c9aff · 2026-11-27T15:02Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Inputs read: card #37307 body and its four comments (7165478297, 7216413780, 7219690738, 7219789648), PR #37971 body, file list (12 files) and net diff against main, PR comments (docs-drift 7219696503, review claim 7221551422), and the check-runs on the head. Every check-run on the head concluded success or skipped; none failed. ① Derived judgmentsWhat the diff changes, each named right or wrong.
(a) The five findings, read against the platform's real rules. The door's universe.
Could a refusal hit a source main serves correctly today? Yes, in two shapes: M1 (a member naming (e) Transcript counts. (h) Tests. The 37 cases pin each of the five ids through ② Semver level
Upgrade entry. Shape: all four required The changeset, sentence by sentence.
③ Boundary flags
④ Design judgmentThe narrowing itself. K4 on main says a M1 (must-fix) — a source member naming S1 (should-fix) — on the CLI, an unprefixed object the stack and its artifact do not define is an error, and that refuses a package whose source indexes an object of a declared dependency the artifact does not carry. The door admits that same source: under the closure a declared dependency's object is in reach, and the door's own remedy is "Declare a dependency on the package that defines ...". An author who follows it then fails S2 (should-fix) — the prescriptions tell a refused author to grant N1 (nit) — "a source that carries one indexes nothing" is the stated reason for the error level in the rule header, N2 (nit) — N3 (nit) — at the door with no closure, a platform-prefixed name nothing registers only warns and a known platform name that is absent is skipped, although the door holds the whole host universe and K4 says refused. Lenient, never a false refusal, and the same as the ladder it copies. A N4 (nit) — the N5 (nit) — the seat's "keep gating" ruling should stand in the thread as the seat's own comment; today only the dev session's attribution exists. The K4 text is enough for this record. N6 (nit) — the entry has no Implemented-by: VERDICT: FAIL |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): REWORK at head 席位核对Shape and gates. Check-runs at f2c9aff: 60 success, 10 skipped, 0 failed. The two timeouts outside the diff passed on the one re-run. Contract review. Record 7221784031 at this head is a FAIL, served at the contract tier ( Owed before ACCEPT.
Nits.
On the new head I will do one delta read with a delta contract review. |
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…unseen declared dependency, `list`-based search prescription - M1: a member's existence is judged through `injectedColumnsFor`, so `id` (driver-provisioned, absent from `injectedColumnDefsFor`) resolves. - S1: on the CLI, while the manifest declares a dependency the artifact does not carry, an unresolved object is a warning with the hedge; under a stated closure or against the whole collection (door) it stays an error. - S2/N2: the search gate prescribes `list` with `searchable` not false; `searchable: false` refuses only beside an `apiMethods` list. - N1: per-verdict wording of what each finding costs. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…d collection Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · head 8301509 · 2026-11-27T17:00Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Delta round on the record in PR comment 7221784031 (head Inputs read: card #37307 body and its six comments (the seat ruling 7221816104 and the rework report 7223340311 among them), PR #37971 body and its five comments, the two author commits, the net diff against main, and the check-runs on the head: 60 success, 12 skipped, none failed, none pending. Merge resolution. First-parent order is merge ① Derived judgments
The three fixes, each read in the tree.
The object split. The search gate. Read against ② Semver level
The changeset rewrite, sentence by sentence.
③ Boundary flags
④ Design judgmentThe narrowing is unchanged in kind: K4's own refusal made real at the door, through the spec's predicates. The delta removes the three places where the previous head disagreed with the platform, and adds no new one. M1 (must-fix): closed Existence resolves through S1 (should-fix): closed Judged against the seat's ruling: the door refuses in both of its readings, and the warning exists only on the CLI while the manifest declares a dependency the artifact does not carry. The door's remedy (declare the dependency) and the CLI verdict now agree: declaring it turns the CLI error into the hedged warning and clears the publish under the closure. The hint, the explain entry, FROM → TO line 1 and the entry's S2 (should-fix): closed Every prescription names N1 (nit): closed N2 (nit): closed N5 (nit): closed N3 (nit) — carried, unchanged by the delta: at the door a known platform name the host does not serve is skipped, and a platform-prefixed name nothing registers warns. The rule now receives N4 (nit) — carried: the N6 (nit) — carried: no N7 (nit) — the changeset still reads N8 (nit) — amendment 7221575164 on #37310 was written before the rework. Its one-line account of No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT (delta) at head 席位核对Delta. The author's change is two commits, 15b32e6 and 2677e83, both in Contract review. Delta record 7224039424 at this head: PASS at the contract tier (
Before the seat's handoff. Follow-ups, not blocking. Record nits N3 (an absent platform-prefixed name is not judged against the whole collection; now a one-condition follow-up), N4 and N6 should become cards. The area should file them under #37307. N8 needs one line on #37310 so its amendment carries the CLI warning arm and the Landing: narrowing ( |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Seat record · 2026-11-27T18:40Z · PR #37971 (Fixes #37307) · head 维护者速读
Seat opinion: land. 席位核对 — ACCEPT · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Approval request · @os-zhuang — a |
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes #37307
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: #37310 (amendment 7221575164: the five rule ids and their fixes)
Premise corrected: card #37307 item 3 ("follow the refuse-or-warn verdict the
ai_contextrow took") conflicts with ADR-0161 K4; K4 wins, so this rule isgatingat publish (refuses), not advisory. Seat 1 ruling on this PR: keep gating (seat record: #37307 comment 7221816104).Ruling-ref:
docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.mdK4 — "It defines no object, extends none, and is refused when the object or a named field does not exist (the lint andos validatechecks are row 4)." and "An object whose package is disabled, that the API exposure refuses for search, or that is a system object withoutenable.aiReadable, and a field the author may not query, each refuse the save with a coded refusal that names the object or the field. A packaged item meets the gates that need no principal inos validateand at publish (row 4)."维护者速读
os validate和发布知识源时,就能看到知识源写错的对象名、字段名,或指向不允许检索的对象(API 不开放检索、系统对象未开放 AI 读取),报错写明是哪个对象、哪个字段。What changes
ADR-0161 K4, row 4: a knowledge source is checked against the objects it names, by
os validate/build/lintand by the runtime publish gate, with one set of rule ids and messages.packages/lint/src/validate-knowledge-source.ts(new):validateKnowledgeSource, five rule ids, exported frompackages/lint/src/index.ts.knowledge-source-object-unknown— error.source.objectnames no object of the stack, of a package of its artifact (packages[]), or at the door of the objects the host serves. Under a stated package closure it is worded for the closure withclosureDependencyRemedy; at the door with no closure (the whole collection the host serves) it is an error too, and an empty served collection is no universe. On the CLI, while the manifest declares a dependency the artifact does not carry, it is a warning with the hedge (the build cannot see that package's objects; the publish judges the source against the closure, which holds them), theflow-trigger-unknown-objectsplit. The laddervalidateObjectReferencesuses: a known platform object (isPlatformProvidedObjectName) is not judged when the stack does not carry its definition; a platform-prefixed name no known package registers is a warning.knowledge-source-field-unknown— error. Asource.content/source.metadataFieldsmember names no field of the object: declared (the stack's own extensions folded in,objectsAsServed) or addressable without a declaration (injectedColumnsFor:id, which the driver provisions, and the injected system columns).knowledge-source-object-not-searchable— error.canServeApiOperation(enable, 'search')is false (the admission module's gate 2):enable.apiEnabled: false, anenable.apiMethodslist that does not grantlist(search derives from it;searchitself is a retired list value the parse strips), or one that grantslistbesideenable.searchable: false. With noapiMethodslist,searchable: falsedoes not refuse it. The fix prescribed: keepapiEnabledtrue and, where the object declaresapiMethods, includelistwithsearchablenot false; or index another object.knowledge-source-system-object-not-ai-readable— error. Asys_object for whichisAiReadExposedis false (the admission module's gate 3).knowledge-source-field-never-indexed— warning. A member names a credential-class field (isMaskedOnReadFieldType, the spec declaration the service's withheld set asks) or aninternal: truefield. The index never carries either (K5). This addition goes past the Execution row, under ADR-0078.authoring-rules.ts: one entry,tier: 'gating', all three commands,surfaces: CLI_AND_RUNTIME,runtimeTypes: ['knowledge_source'], with the package scope passed through, andwholeCollectionset at the door when no scope is stated.runtime-gate.ts:knowledge_source: 'knowledgeSources'.rule-explanations.ts: oneos explainentry for each of the five ids.packages/spec/src/migrations/entries/semantic/19.knowledge-source-publish-refuses-missing-references-and-gated-objects.ts: the upgrade-guide entry.check:adr-0087-registrationrequires it:Metadata-protocol: narrowedrefusesno-migration-prescriptionoutright. This file is outside the claim's declared file surface..changeset/37307-knowledge-source-references.md:@objectstack/lintminor,@objectstack/specpatch, BREAKING, registered disposition.The at-publish verdict: refuse, not advise, against the
ai_contextprecedentThe
ai_contextrow (validateAiContext) is advisory at publish. Its reason is that a pack still reads what resolves (ADR-0160 D1). This row departs from it, for three reasons. ADR-0161 K4 says an item "is refused when the object or a named field does not exist (the lint andos validatechecks are row 4)". It also says that "a packaged item meets the gates that need no principal inos validateand at publish". And each of the four errors defeats retrieval (a missing object leaves nothing to index, a missing field indexes no text for that member, a gated object is never searched for a caller the service judges), so the card's severity section (all four are errors) has the same reading. The rule is thereforegating: its errors refuse the publish (422 with the rule id, path, message and hint), and its warnings ride the 2xxadvisories. The card's sentence "follow the refuse-or-warn verdict theai_contextrow took" and its severity section cannot both hold. The ADR text decides between them, and the departure is stated in the rule header, the registry entry and the runtime-gate row.What this narrows at publish, measured on the code paths:
403(authoredKnowledgeSourceRefusal), before this gate runs. Where no author judgement is reached, the publish is now refused422: a host with no knowledge service, or a system-context write.canServeApiOperation(undefined)is true, and with no security service the field gate is masked-only).os validate/build/lintexit 1 on the same source.Declarations: the claim expected
Clause-②: no/Metadata-protocol: none. The measured reading isClause-②: yes (narrowing), because five new exports widen@objectstack/lint's public surface and a new refusal narrows the accept set, andMetadata-protocol: narrowed, because a requirement is tightened. So the lint bump isminorand the title carries!.Tests
packages/lint/src/validate-knowledge-source.test.ts(44 cases):runAuthoringRules('validate'): a missing object, content field or metadata field;apiEnabled: false; anapiMethodslist that does not grant search;searchable: false; asys_object withoutaiReadable. Each prints exactly one finding, with its rule id, severity, path, and the object or field named. A clean source prints none.internalwarnings.runRuntimeAuthoringRuleswithtype: 'knowledge_source'). Errors land inerrors(refused) and warnings inadvisories, and the face (rule, severity, where, message, hint) equals theos validateface.packageScope, with a non-vacuous control: declaring the dependency clears it.packages[], a known platform object skipped, an unknown platform-prefixed name as a warning,listgrantingsearch.metadataFields: ['id']andcontent: ['id']resolve (CLI and door);enable.searchable: falsewith noapiMethodslist is clean.packages[]does not carry, an error when every declared dependency is carried or none is declared; against the whole collection an error beside the same unseen dependency; an empty served collection at the door judges no object.explainRuleanswers all five ids.Readings (lint suite at 73441db; the head 3ea6b3c adds only the four docs transcript counts)
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2(with spec and lint rebuilt, then linttypecheck): lock VERDICT command-exit 0, Test Files 243 passed (243), Tests 9836 passed (9836); typecheck exit 0 (check:test-typecheckincluded;tsc -p tsconfig.test.json --listFileslists the new test file, 1 hit).pnpm --filter @objectstack/spec exec vitest run src/migrationsafter the spec build: 5 files, 206 tests passed.scripts/ablation-replace.mjs, a trap restore, andgit diff HEADempty after restore. Every leg went red: the runtime-gate row removed (12 red); the object-unknown error made a warning (3); the API gate off (6); the system-object gate off (2); the withheld warning off (4); the injected-column merge off (1); the artifactpackages[]resolution off (1); the closure branch off (1); the platform-object skip off (1); the stack extensions not folded (1).objectstack validateinexamples/app-showcaseexits 0 with zeroknowledge-source-*findings, so the shipped corpus is clean. The same command withcontentmutated to['title', 'notez', 'secret_note']exits 1 with twoknowledge-source-field-unknownfindings atknowledgeSources[0].source.content[1]and[2], and the file is restored.objectstack explain knowledge-source-object-unknownandobjectstack explain knowledge-source-system-object-not-ai-readableboth answer.pnpm --filter @objectstack/dogfood test, lock VERDICT command-exit 1, head 73441db): Test Files 14 failed / 476 passed / 3 skipped (493); Tests 20 failed / 4113 passed / 79 skipped (4212). The failures were 17Test timed out in 5000ms, 2 hook timeouts, the cascadingalready has a live bootStack kernelerrors, and 1 assertion inside a timed-out file. None names aknowledge-source-*rule. The 14 failed files re-run alone on the same head: 14 passed (14), 164 passed (164), VERDICT command-exit 0. Read as shared-box contention, not this diff.Rework readings (review 7221784031: M1, S1, S2, N1, N2; head 8301509)
turbo run build --filter='@objectstack/lint...'5/5 tasks; the lint suite Test Files 244 passed (244), Tests 9856 passed (9856); specsrc/migrations5 files, 206 tests passed;check:docs-transcript-driftexit 0 against the built registry (4 declared values, 87).pnpm --filter @objectstack/lint typecheckexit 0 (check:test-typecheckincluded).scripts/ablation-replace.mjswith a trap restore andgit diff HEADempty after: theinjectedColumnsForexistence check off (2 red,idamong them); the CLI dependency hedge off (2 red); the whole-collection reading off in the rule (1 red); the registry'swholeCollectionpass set false (1 red); the empty-universe skip off (2 red).check:docs-transcript-driftexit 0 (87; feat(lint): warn when a select option colour renders neutral on the option badge #37986 still open),check-adr-0087-registrationexit 0,check:nul-bytesexit 0,overlap-checkVERDICT clean.Derived gates (dispatch-gates --commands, then --ran)
check:docs-transcript-driftwas red (four CLI transcripts printed 85 author-time rules, and this rule makes 86); the four counts were fixed in 3ea6b3c, and the gate now exits 0 (4 declared values equal the derived count).check:exported-anyreturned exit 3 while the dogfood build was rebuildingpackages/spec/dist; re-run after that build, it exits 0.check:dual-build-cjs-loadsreturned exit 3 because thestudio,client-reactandscenariosdist are not built here: NOT MEASURED, CI.check:type-check-debtreturned exit 3 on a lock queue-timeout (another seat's hold): NOT MEASURED, CI.check:skill-examplesreturned exit 3 because theclient-reactdist is not built: NOT MEASURED, CI.check:api-surfaceandcheck:docsexit 0 after the spec rebuild.overlap-checkVERDICT clean before every push; fix(lint,core)!: refuse a lookup dependsOn filter key naming a formula of its target; an import lookup no scoped read answered is never out of scope #37910 and fix(spec)!: a book audience names one gate, and a gated book claims its pages by name #37870 merge cleanly. fix(spec)!: a book audience names one gate, and a gated book claims its pages by name #37870 bumps the same four transcript counts, so whichever lands second needs 87.Acceptance notes
apiMethods: ['get', 'list']grantssearch(listgrants it unlessenable.searchableis false). The save-door refusal text inservice-knowledge(admitAuthoredSource,object-api-not-served) reads "itsenable.apiMethodslist does not includesearch". Forsearchable: falsewithlistgranted, that wording names the wrong cause. Wording only; the PM files it as a card with the S2 wording.sys_user) is not judged, because its declaration is not in hand. The publish door judges it against the live definition.Verification
Read first, by risk:
packages/lint/src/authoring-rules.ts, thevalidateKnowledgeSourceentry (tier: 'gating'on the publish door is the narrowing).packages/lint/src/validate-knowledge-source.ts, the object ladder and the two gates..changeset/37307-knowledge-source-references.md.Two-minute check: in
examples/app-showcase/src/ai/task-notes.knowledge-source.ts, changecontent: ['title', 'notes']to['title', 'notez']and runpnpm exec objectstack validateinexamples/app-showcase. Expected: exit 1 andrule: knowledge-source-field-unknown at knowledgeSources[0].source.content[1]. Unchanged, the showcase validates with zeroknowledge-source-*findings.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP